<template>
  <div>
      <el-card class="box-card">
        <div slot="header" class="clearfix">
          <span>最新发布成果</span>
        </div>
        <div class="item" v-for="(item,index) in dataList" :key="index">
          <el-link :underline="false" @click="GoOneAch(item)" class="linkcontent">{{item.achname}}</el-link>
        </div>
      </el-card>
      <el-divider class="divi"></el-divider>
      <el-button type="primary" plain @click="Result()" class="release">发布成果</el-button>
      <el-divider class="divi"></el-divider>
  </div>
</template>


<script>
export default {
  name: 'STAAside',
  data () {
    return {
      dataList:"",
    }
  },
  methods:{
    // 跳转到具体的一个成果
    GoOneAch(item){
      console.log(item);
      this.$router.push({
        path: '/AchDetail',
        query: {
          achname:item.achname,
          achtype:item.achtype,
          achdate:item.achdate,
          achprice:item.achprice,
          achfield:item.achfiled,
          achindu:item.achindu,
          achremark:item.achremark,
          achrelarequire:item.achrelarequire,
          achown:item.achown,
          achcontact:item.achcontact,
          achmail:item.achmail,
          achpubno:item.achpubno,
          lawstatus:item.lawstatus,
          achphase:item.achphase,
          transinten:item.transinten,
          achpicurl:item.achpicurl,
        }
      });
    },
    getData(){
      let params={
        currentPage: 1,
        pageSize: 8,
      }
      this.api.getinfoBydate(params).then(res => {
        let {code, message, data} = res;
        if(['200', 200].includes(code) && res.success == true) {
          console.log(data);
          this.dataList = data;
        }
        else {
            this.$message({
                type: "info",
                message: message
            })
        }
      }).catch(err => {
          this.$message({
              type: "info",
              message: err
          })
      })
    },
    Result(){
      this.$router.push({path:'/Result'})
    }
  },
  create(){
    this.getData();
  }
}
</script>


<style scope>
  .text {
    font-size: 14px;
  }
  .item {
    margin-bottom: 18px;
  }
  .clearfix:after {
    display: table;
    content: "";
  }
  .clearfix:after {
    clear: both
  }
  .box-card {
    height: 100%;
  }
</style>